// This is JDefenceTower, a simple tower defence style game 
//
// Copyright (C) 2010 Maximilian Junker
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 3 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, see <http://www.gnu.org/licenses/>.

package junker.defence.model;

public class MapObjectDescription {
	private boolean			isBarrier;
	private int				speed;
	private boolean			movesToSink;
	private boolean			doesCreate;
	private CreationPattern	creationPattern	= null;

	public boolean isBarrier() {
		return isBarrier;
	}

	public void setBarrier(boolean isBarrier) {
		this.isBarrier = isBarrier;
	}

	public float getSpeed() {
		return this.speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}
	
	public boolean movesToSink() {
		return movesToSink;
	}

	public void setMovesToSink(boolean movesToSink) {
		this.movesToSink = movesToSink;
	}

	public boolean doesCreate() {
		return doesCreate;
	}

	public void setDoesCreate(boolean doesCreate) {
		this.doesCreate = doesCreate;
	}

	public CreationPattern getCreationPattern() {
		return creationPattern;
	}

	public void setCreationPattern(CreationPattern creationPattern) {
		this.creationPattern = creationPattern;
	}

	public MapObject createMapObject(Map map){
		MapObject mo = new MapObject(this);
		if(movesToSink){
			mo.addCapability(new MoveToSinkBehaviour());
		}
		if(doesCreate){
			assert this.creationPattern!=null;
			mo.addCapability(new PeriodicCreateBehaviour(this.creationPattern,map));
		}
		return mo;
	}
}